package cn.sirun.com.fca.account.loader;

import com.tencent.cloud.iov.kernel.model.BaseResponse;

import cn.sirun.com.fca.account.model.base.CarInfoDetailResponse;
import cn.sirun.com.fca.account.model.login.AuthenticateRequest;
import cn.sirun.com.fca.account.model.login.AuthenticateResponse;
import cn.sirun.com.fca.account.model.login.ChallengeRequest;
import cn.sirun.com.fca.account.model.login.ChallengeResponse;
import cn.sirun.com.fca.account.model.login.LoginRequest;
import cn.sirun.com.fca.account.model.login.LoginResponse;
import cn.sirun.com.fca.account.model.login.PersonalInfo;
import cn.sirun.com.fca.account.model.login.PersonalInfoRequest;
import cn.sirun.com.fca.account.model.login.VehicleRespons;
import cn.sirun.com.fca.account.repo.login.LoginRepository;
import io.reactivex.Observable;
import io.reactivex.schedulers.Schedulers;

public class LoginLoader extends AccountFlowLoader {

    public Observable<BaseResponse<ChallengeResponse>> challenge(ChallengeRequest request) {
        return LoginRepository.getInstance().challenge(request)
                .subscribeOn(Schedulers.io());
    }

    public Observable<BaseResponse<LoginResponse>> passwordLogin(LoginRequest request) {
        return LoginRepository.getInstance().passwordLogin(request)
                .subscribeOn(Schedulers.io());
    }

    public Observable<BaseResponse<AuthenticateResponse>> authenticate(
            AuthenticateRequest request) {
        return LoginRepository.getInstance().authenticate(request)
                .subscribeOn(Schedulers.io());
    }

    public Observable<BaseResponse<VehicleRespons>> getVehicle() {
        return LoginRepository.getInstance().getVehicle()
                .subscribeOn(Schedulers.io());
    }

    public Observable<BaseResponse<PersonalInfo>> getPersonalInfo(PersonalInfoRequest request) {
        return LoginRepository.getInstance().getPersonalInfo(request)
                .subscribeOn(Schedulers.io());
    }

    public Observable<BaseResponse<CarInfoDetailResponse>> getCarInfo(String din) {
        return LoginRepository.getInstance().getCarInfoDetail(din)
                .subscribeOn(Schedulers.io());
    }
}
